package com.twu.biblioteca;

import java.util.ArrayList;
import java.util.List;

public class Readers {
    private List<Reader> readerList = new ArrayList<Reader>();

    public void add(Reader reader) {
        readerList.add(reader);
    }

    public boolean contains(Reader reader) {
        return readerList.contains(reader);
    }

    public String whoIsReading(String name) {
        for (Reader reader : readerList) {
            if(reader.reading(name)){
                return reader.name();
            }
        }
        return  null;
    }

    public Reader getReader(String name) {
        for (Reader reader : readerList) {
            if(reader.name().equals(name)){
                return reader;
            }
        }
        return  null;
    }
}
